﻿using FaceWebServer.DB.Log;
using FaceWebServer.Interface;
using Microsoft.EntityFrameworkCore;

namespace FaceWebServer.Service
{
    /// <summary>
    /// 人脸机API调用日志服务
    /// </summary>
    public class ConnectIOLogService : BaseService, IConnectIOLogService
    {


        public ConnectIOLogService(DbContext context) : base(context)
        {

        }

        public bool AddConnectLog(ConnectIOLog log)
        {
            var db = this.Context.Set<ConnectIOLog>();

            log.LogTime = System.DateTime.Now;

            db.Add(log);
            Commit();
            return true;
        }

        public bool ClearLog()
        {
            Excute<ConnectIOLog>("Delete from ConnectIOLog", null);
            return true;
        }
    }
}
